package com.czxy.config;

import com.czxy.dao.CategoryDao;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

// 告知Spring 该类是一个配置类
@Configuration
// 告知Spring 要管理的目标类在哪个包下
@ComponentScan({"com.czxy.dao","com.czxy.service"})
@PropertySource("classpath:db.properties")
public class SpringConfig {

    @Bean
    public static PropertySourcesPlaceholderConfigurer create(){
        return new PropertySourcesPlaceholderConfigurer();
    }


    @Bean
    public CategoryDao getCategoryDao(){
        return new CategoryDao();
    }


}
